//
//  LQYPasswordLoginController.m
//  BuDeJie
//
//  Created by runone02 on 2018/6/15.
//  Copyright © 2018年 李启云. All rights reserved.
//

#import "LQYPasswordLoginController.h"
#import "LQYPasswordLoginView.h"
#import "LQForgetPasswordController.h"
@interface LQYPasswordLoginController ()
@property (nonatomic ,strong) LQYPasswordLoginView *passwordLoginView;
@end

@implementation LQYPasswordLoginController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    self.passwordLoginView = [[LQYPasswordLoginView alloc]init];
    [self.view addSubview:self.passwordLoginView];
    [self.passwordLoginView.isVisual addTarget:self action:@selector(isVisual:) forControlEvents:UIControlEventTouchUpInside];
    [self.passwordLoginView.forgetPassWord addTarget:self action:@selector(forgetPassWordClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.passwordLoginView.loginBtn addTarget:self action:@selector(loginBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.passwordLoginView.enrollBtn addTarget:self action:@selector(enrollBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.passwordLoginView.authorizedLoginBtn addTarget:self action:@selector(authorizedLoginBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.passwordLoginView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.view).with.offset (80);
        make.left.mas_equalTo(self.view);
        make.right.mas_equalTo(self.view);
        make.bottom.mas_equalTo(self.view);
    }];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [self.view endEditing:YES];
}

//按钮点击
- (void)isVisual:(UIButton *)button {
    button.selected = !button.selected;
    if (button.selected == YES) {
        
        self.passwordLoginView.isVisual.backgroundColor = [UIColor blackColor];
        self.passwordLoginView.passWordTF.secureTextEntry = NO;
    } else {
        button.selected = !button.selected;
        self.passwordLoginView.isVisual.backgroundColor = [UIColor redColor];
        self.passwordLoginView.passWordTF.secureTextEntry = YES;
    }
}

//忘记密码
- (void)forgetPassWordClick:(UIButton *)button {
    LQForgetPasswordController *foret = [[LQForgetPasswordController alloc]init];
    [self.navigationController pushViewController:foret animated:YES];
}

//注册登录
- (void)enrollBtnClick:(UIButton *)button {
    NSLog(@"注册登录");
}

//登录
- (void)loginBtnClick:(UIButton *)button {
    NSLog(@"登录");
}

//授权登录
- (void)authorizedLoginBtnClick:(UIButton *)button {
    NSLog(@"授权登录");
}


@end
